package com.dji.compose_learning.ui.view

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import com.dji.compose_learning.R

@Composable
fun LayoutSampleView() {
    PhotographerCard()
}

@Composable
fun PhotographerCard() {
    Row(modifier = Modifier
        .wrapContentHeight(align = Alignment.Top)    //类似wrapContent，参数是在这个方向上的位置：居中 居左 居右
        .wrapContentWidth(align = Alignment.Start)
        .clip(RoundedCornerShape(5.dp))
        .background(MaterialTheme.colorScheme.surface)
        .clickable { }
        .padding(16.dp)) {
        Surface(modifier = Modifier.size(50.dp),
            shape = CircleShape,
            color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.2f)) {
            Image(painter = painterResource(id = R.drawable.img),
                contentDescription = "advert")
        }
        Column(modifier = Modifier
            .padding(start = 8.dp)) {
            Text(text = "Buobao", fontWeight = FontWeight.Bold)
//            CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.tertiaryContainer ) {
//
//            }
            Text(text = "2 minutes age", style = MaterialTheme.typography.bodyMedium, modifier = Modifier.alpha(0.3f))
        }
    }

}